#include <iostream>

using namespace std;

const int N = 10010;

int q[N];
int hh = 0, tt = -1;

int n, m;
int cnt;

int main()
{
	cin >> n >> m;
	
	for (int i = 1; i <= n; i ++ )  q[ ++ tt] = i;
	
	while (hh <= tt)
	{
		int a = q[hh ++ ];
		cnt ++ ;
		
		if (cnt % m == 0) 
		{
			cout << a << ' ';
			continue;
		}
		q[ ++ tt] = a;
	}
	
	return 0;
}